home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / netz / term / extras / source / term-source.lha / termGlobal.h < prev    next >
Text File  |  1995-06-19  |  42KB  |  1,662 lines

  1. /*
  2. **    termGlobal.h
  3. **
  4. **    Global data structure definitions
  5. **
  6. **    Copyright © 1990-1995 by Olaf `Olsen' Barthel
  7. **        All Rights Reserved
  8. */
  9.  
  10.     /* The configuration file format version. This will from now
  11.      * on hopefully stay the same.
  12.      */
  13.  
  14. #define CONFIG_FILE_VERSION    4
  15. #define CONFIG_FILE_REVISION    3
  16.  
  17.     /* Jump table entry. */
  18.  
  19. typedef BYTE (*  JUMP)(UBYTE Char);
  20.  
  21.     /* Pointer to function returning nothing. */
  22.  
  23. typedef VOID (* VPTR)();
  24.  
  25.     /* Capture output routine. */
  26.  
  27. typedef VOID (* __regargs COPTR)(register APTR Data,register LONG Size);
  28.  
  29.     /* Menu item codes. */
  30.  
  31. enum    {    MEN_SAVE_AS_PICTURE=1,MEN_SAVE_AS_TEXT,MEN_PRINT_SCREEN,MEN_PRINT_CLIP,MEN_CAPTURE_TO_FILE,
  32.         MEN_CAPTURE_TO_PRINTER,MEN_ICONIFY,MEN_ABOUT,MEN_QUIT,
  33.  
  34.         MEN_COPY,MEN_PASTE,MEN_CLEAR,
  35.  
  36.         MEN_EXECUTE_DOS_COMMAND,MEN_EXECUTE_REXX_COMMAND,MEN_RECORD,MEN_RECORD_LINE,
  37.         MEN_EDIT_TRAPS,MEN_DISABLE_TRAPS,
  38.  
  39.         MEN_PHONEBOOK,MEN_REDIAL,MEN_DIAL_NUMBER,MEN_SEND_BREAK,
  40.         MEN_HANG_UP,MEN_WAIT,MEN_FLUSH_BUFFER,MEN_RELEASE_DEVICE,
  41.  
  42.         MEN_UPLOAD_ASCII,MEN_DOWNLOAD_ASCII,MEN_UPLOAD_TEXT,MEN_DOWNLOAD_TEXT,MEN_EDIT_AND_UPLOAD_TEXT,
  43.         MEN_UPLOAD_BINARY,MEN_DOWNLOAD_BINARY,
  44.  
  45.         MEN_CLEAR_BUFFER,MEN_DISPLAY_BUFFER,MEN_CLOSE_BUFFER,MEN_FREEZE_BUFFER,MEN_OPEN_BUFFER,
  46.         MEN_SAVE_BUFFER_AS,
  47.  
  48.         MEN_CLEAR_SCREEN,MEN_RESET_FONT,MEN_RESET_STYLES,MEN_RESET_TERMINAL,
  49.  
  50.         MEN_SERIAL,MEN_MODEM,MEN_SCREEN,MEN_TERMINAL,MEN_SET_EMULATION,MEN_CLIPBOARD,MEN_CAPTURE,MEN_COMMANDS,
  51.         MEN_MISC,MEN_PATH,MEN_TRANSFER_PROTOCOL,MEN_TRANSFER,MEN_TRANSLATION,MEN_MACROS,
  52.         MEN_CURSORKEYS,MEN_FAST_MACROS,MEN_HOTKEYS,MEN_SPEECH,MEN_SOUND,MEN_RATES,MEN_SET_CONSOLE,MEN_OPEN_SETTINGS,MEN_SAVE_SETTINGS,
  53.         MEN_SAVE_SETTINGS_AS,
  54.  
  55.         MEN_STATUS_WINDOW,MEN_REVIEW_WINDOW,MEN_PACKET_WINDOW,MEN_CHAT_LINE,MEN_FAST_MACROS_WINDOW,
  56.         MEN_UPLOAD_QUEUE_WINDOW,
  57.  
  58.         // Avoid recompilation
  59.  
  60.         MEN_PRINT_SCREEN_AS_GFX,
  61.         MEN_EXTRA_DIAL
  62.     };
  63.  
  64.     /* Menu item code limit, required by the quick dial menu. */
  65.  
  66. #define DIAL_MENU_LIMIT 1000
  67.  
  68.     /* How many phone book entries will be stored in
  69.      * the quick dial menu.
  70.      */
  71.  
  72. #define DIAL_MENU_MAX    50
  73.  
  74.     /* Undefine the following symbols, the preferences header file
  75.      * will use the same names and the same values.
  76.      */
  77.  
  78. #undef PARITY_NONE
  79. #undef PARITY_EVEN
  80. #undef PARITY_ODD
  81. #undef PARITY_MARK
  82. #undef PARITY_SPACE
  83.  
  84.     /* Serial settings. */
  85.  
  86. enum    {    PARITY_NONE,PARITY_EVEN,PARITY_ODD,PARITY_MARK,PARITY_SPACE };
  87.  
  88. enum    {    HANDSHAKING_NONE,HANDSHAKING_RTSCTS,HANDSHAKING_RTSCTS_DSR };
  89. enum    {    DUPLEX_FULL,DUPLEX_HALF };
  90. enum    {    FLOW_NONE,FLOW_XON_XOFF };
  91.  
  92.     /* Terminal settings. */
  93.  
  94. enum    {    EOL_IGNORE,EOL_CR,EOL_LF,EOL_CRLF,EOL_LFCR };
  95. enum    {    EMULATION_ANSIVT100,EMULATION_ATOMIC,EMULATION_TTY,EMULATION_EXTERNAL,EMULATION_HEX };
  96. enum    {    COLOUR_AMIGA,COLOUR_EIGHT,COLOUR_SIXTEEN,COLOUR_MONO };
  97.  
  98.     /* Protocol types. */
  99.  
  100. enum    {    PROTOCOL_XMODEM,PROTOCOL_XMODEMCRC,PROTOCOL_YMODEM,PROTOCOL_ZMODEM };
  101.  
  102.     /* Font types. */
  103.  
  104. enum    {    FONT_STANDARD,FONT_IBM,FONT_IBM_RAW };
  105.  
  106.     /* Bell modes. */
  107.  
  108. enum    {    BELL_NONE, BELL_VISIBLE, BELL_AUDIBLE, BELL_BOTH, BELL_SYSTEM };
  109.  
  110.     /* Data flow scanner indices. */
  111.  
  112. enum    {    SCAN_NOCARRIER, SCAN_CONNECT, SCAN_VOICE, SCAN_RING, SCAN_BUSY, SCAN_NODIALTONE,
  113.         SCAN_OK, SCAN_ERROR, SCAN_SIGDEFAULTUPLOAD, SIG_DEFAULTUPLOAD,
  114.         SCAN_SIGASCIIUPLOAD,SCAN_SIGASCIIDOWNLOAD, SCAN_SIGTEXTUPLOAD,
  115.         SCAN_SIGTEXTDOWNLOAD, SCAN_SIGBINARYUPLOAD,
  116.         SCAN_SIGBINARYDOWNLOAD, SCAN_COUNT
  117.     };
  118.  
  119.     /* Status types. */
  120.  
  121. enum    {    STATUS_READY,STATUS_HOLDING,STATUS_DIALING,STATUS_UPLOAD,
  122.         STATUS_DOWNLOAD,STATUS_BREAKING,STATUS_HANGUP,
  123.         STATUS_RECORDING,STATUS_RECORDING_LINE
  124.     };
  125.  
  126.     /* Sound types. */
  127.  
  128. enum    {    SOUND_BELL,SOUND_CONNECT,SOUND_DISCONNECT,SOUND_GOODTRANSFER,
  129.         SOUND_BADTRANSFER,SOUND_RING,SOUND_VOICE,SOUND_ERROR,
  130.         SOUND_COUNT
  131.     };
  132.  
  133.     /* Settings types. */
  134.  
  135. enum    {    PREF_ALL,PREF_SERIAL,PREF_MODEM,PREF_COMMAND,PREF_SCREEN,
  136.         PREF_TERMINAL,PREF_PATH,PREF_MISC,PREF_CLIP,PREF_CAPTURE,
  137.         PREF_FILE,PREF_EMULATION,PREF_TRANSFER };
  138.  
  139.     /* Status line modes. */
  140.  
  141. enum    {    STATUSLINE_DISABLED,STATUSLINE_STANDARD,STATUSLINE_COMPRESSED };
  142.  
  143.     /* Capture filter modes. */
  144.  
  145. enum    {    FILTER_NONE,FILTER_ESCAPE,FILTER_CONTROL,FILTER_BOTH };
  146.  
  147.     /* Scrolling modes. */
  148.  
  149. enum    {    SCROLL_JUMP,SCROLL_SMOOTH };
  150.  
  151.     /* Auto-capture file creation. */
  152.  
  153. enum    {    AUTOCAPTURE_DATE_NAME,AUTOCAPTURE_DATE_INCLUDE };
  154.  
  155.     /* Cursor and numeric keypad modes. */
  156.  
  157. enum    {    KEYMODE_STANDARD,KEYMODE_APPLICATION };
  158.  
  159.     /* Font scales. */
  160.  
  161. enum    {    SCALE_NORMAL,SCALE_HALF };
  162. enum    {    SCALE_ATTR_NORMAL,SCALE_ATTR_TOP2X,SCALE_ATTR_BOT2X,SCALE_ATTR_2X };
  163.  
  164.     /* Character tables. */
  165.  
  166. enum    {    TABLE_ASCII,TABLE_GFX };
  167.  
  168.     /* Transfer types. */
  169.  
  170. enum    {    TRANSFER_BINARY,TRANSFER_TEXT,TRANSFER_ASCII };
  171.  
  172.     /* Translation table entry types. */
  173.  
  174. enum    {    TRANSLATE_SINGLE,TRANSLATE_STRING };
  175.  
  176.     /* Upload panel actions. */
  177.  
  178. enum    {    UPLOAD_TEXT=1,UPLOAD_BINARY,UPLOAD_IGNORE,UPLOAD_ABORT,
  179.         UPLOAD_TEXT_FROM_LIST,UPLOAD_BINARY_FROM_LIST,UPLOAD_DUMMY
  180.     };
  181.  
  182.     /* Alert types. */
  183.  
  184. enum    {    ALERT_NONE,ALERT_BEEP,ALERT_SCREEN,ALERT_BEEP_SCREEN };
  185.  
  186.     /* Online time display modes. */
  187.  
  188. enum    {    ONLINETIME_TIME,ONLINETIME_COST,ONLINETIME_BOTH };
  189.  
  190.     /* Clipboard read errors. */
  191.  
  192. enum    {    CLIPERR_NONE,CLIPERR_NOTEXT,CLIPERR_IFF,CLIPERR_OPEN,CLIPERR_MEM };
  193.  
  194.     /* What to print. */
  195.  
  196. enum    {    PRINT_SCREEN,PRINT_CLIP };
  197.  
  198.     /* Dial command types. */
  199.  
  200. enum    {    DIAL_IGNORE,DIAL_LIST,DIAL_REDIAL };
  201.  
  202.     /* Errors returned by ReconfigureSerial(). */
  203.  
  204. enum    {    RECONFIGURE_FAILURE,RECONFIGURE_NOCHANGE,RECONFIGURE_SUCCESS };
  205.  
  206.     /* Operation codes for SetItem(). */
  207.  
  208. enum    {    SETITEM_SETCHECK,SETITEM_CLRCHECK,SETITEM_ON,SETITEM_OFF };
  209.  
  210.     /* File identification actions. */
  211.  
  212. enum    {    IDENTIFY_IGNORE,IDENTIFY_FILETYPE,IDENTIFY_SOURCE };
  213.  
  214.     /* Generic list types. */
  215.  
  216. enum    {    GLIST_UPLOAD,GLIST_DOWNLOAD,GLIST_DIAL,GLIST_WAIT,GLIST_TRAP,GLIST_COUNT };
  217.  
  218.     /* Generic list add operations. */
  219.  
  220. enum    {    ADD_GLIST_BOTTOM,ADD_GLIST_TOP,ADD_GLIST_BEHIND,ADD_GLIST_BEFORE };
  221.  
  222.     /* Dialing modes. */
  223.  
  224. enum    {    DIALMODE_PULSE, DIALMODE_TONE };
  225.  
  226.     /* Transfer window gadgets. */
  227.  
  228. enum    {    GAD_TRANSFER_INFORMATION_LIST=1,
  229.         GAD_TRANSFER_PERCENT,GAD_TRANSFER_TIME,
  230.         GAD_TRANSFER_ABORT,GAD_TRANSFER_SKIP,
  231.         GAD_TRANSFER_PROTOCOL,GAD_TRANSFER_FILE,
  232.         GAD_TRANSFER_SIZE,GAD_TRANSFER_SECONDS,
  233.         GAD_TRANSFER_TOTALTIME,GAD_TRANSFER_ERRORS,
  234.         GAD_TRANSFER_ABORT_FILE
  235.     };
  236.  
  237.     /* How to satisfy OwnDevUnit.library requests. */
  238.  
  239. enum    {    ODU_RELEASE,ODU_WAIT,ODU_KEEP };
  240.  
  241.     /* When to notify the user during a file transfer. */
  242.  
  243. enum    {    XFERNOTIFY_NEVER,XFERNOTIFY_ALWAYS,XFERNOTIFY_START,XFERNOTIFY_END };
  244.  
  245.     /* XPR options setting. */
  246.  
  247. enum    {    GAD_XPROPTIONS_USE=42,GAD_XPROPTIONS_CANCEL };
  248.  
  249.     /* AmigaGuide help context. */
  250.  
  251. enum    {    CONTEXT_MAIN,CONTEXT_SERIAL,CONTEXT_MODEM,CONTEXT_SCREEN,
  252.         CONTEXT_TERMINAL,CONTEXT_CLIP,CONTEXT_CAPTURE,CONTEXT_COMMAND,
  253.         CONTEXT_MISC,CONTEXT_PATHS,CONTEXT_TRANSLATION,CONTEXT_MACROS,
  254.         CONTEXT_CURSOR,CONTEXT_FASTMACROS,CONTEXT_HOTKEYS,CONTEXT_SPEECH,
  255.         CONTEXT_EMULATION,CONTEXT_TRANSFER,CONTEXT_PHONEBOOK,CONTEXT_DATE,
  256.         CONTEXT_DAY,CONTEXT_IMPORT,CONTEXT_RATES,CONTEXT_TIME,
  257.         CONTEXT_COPY,CONTEXT_PASSWORDUSER,CONTEXT_DIAL,CONTEXT_PRINT,
  258.         CONTEXT_TEXTBUFFER,CONTEXT_PACKETWINDOW,CONTEXT_SOUND,
  259.         CONTEXT_LIBS,CONTEXT_ASCII,CONTEXT_PENS,CONTEXT_UPLOAD_QUEUE,
  260.         CONTEXT_TRAPS,CONTEXT_AREA_CODES,CONTEXT_MAIN_MENU,
  261.         CONTEXT_BUFFER_MENU,CONTEXT_PACKET_MENU,CONTEXT_PROJECT_MEN,
  262.         CONTEXT_EDIT_MEN,CONTEXT_CMDS_MEN,CONTEXT_PHONE_MEN,
  263.         CONTEXT_TRANSF_MEN,CONTEXT_BUFFER_MEN,CONTEXT_TERMINAL_MEN,
  264.         CONTEXT_SETTINGS_MEN,CONTEXT_WINDOWS_MEN,CONTEXT_DIAL_MEN,
  265.         CONTEXT_TEXTPEN_PANEL,CONTEXT_ASCII_TRANSFER_SETTINGS,
  266.         CONTEXT_PARAMETERS,CONTEXT_SIGNATURE
  267.  
  268.     };
  269.  
  270.     /* Character types. */
  271.  
  272. enum    {    CHAR_VANILLA,CHAR_CURSOR,CHAR_FUNCTION,CHAR_HELP,
  273.         CHAR_XON,CHAR_XOFF,CHAR_ENTER,CHAR_RETURN };
  274.  
  275.     /* Review window positioning codes. */
  276.  
  277. enum    {    REVIEW_MOVE_TOP,REVIEW_MOVE_BOTTOM,REVIEW_MOVE_UP,REVIEW_MOVE_DOWN };
  278.  
  279.     /* File type classes. */
  280.  
  281. enum    {    FILETYPE_NONE,FILETYPE_DIR,FILETYPE_FILE,FILETYPE_TEXT,FILETYPE_SOUND,
  282.         FILETYPE_PICTURE,FILETYPE_PREFS,FILETYPE_ARCHIVE,
  283.         FILETYPE_PROGRAM,
  284.  
  285.         FILETYPE_COUNT };
  286.  
  287.     /* Text pacing modes. */
  288.  
  289. enum    {    PACE_DIRECT,PACE_ECHO,PACE_ANYECHO,PACE_PROMPT,PACE_DELAY,PACE_KEYBOARD };
  290.  
  291.     /* Where to open the buffer text window. */
  292.  
  293. enum    {    BUFFER_TOP,BUFFER_END };
  294.  
  295.     /* Where to place the buffer screen horizontally. */
  296.  
  297. enum    {    SCREEN_LEFT,SCREEN_CENTRE,SCREEN_RIGHT };
  298.  
  299.     /* File transfer mode. */
  300.  
  301. enum    {    XFER_XPR,XFER_EXTERNALPROGRAM,XFER_DEFAULT,XFER_INTERNAL };
  302.  
  303.     /* File transfer protocol signatures. */
  304.  
  305. enum    {    TRANSFERSIG_DEFAULTUPLOAD,TRANSFERSIG_DEFAULTDOWNLOAD,
  306.         TRANSFERSIG_ASCIIUPLOAD,TRANSFERSIG_ASCIIDOWNLOAD,
  307.         TRANSFERSIG_TEXTUPLOAD,TRANSFERSIG_TEXTDOWNLOAD,
  308.         TRANSFERSIG_BINARYUPLOAD,TRANSFERSIG_BINARYDOWNLOAD
  309.     };
  310.  
  311.     /* Requester modes. */
  312.  
  313. enum    {    REQUESTERMODE_CENTRE,REQUESTERMODE_PREFS,
  314.         REQUESTERMODE_IGNORE
  315.     };
  316.  
  317.     /* Some raw key codes. */
  318.  
  319. #define HELP_CODE        95
  320. #define DEL_CODE        70
  321. #define BACKSPACE_CODE        65
  322. #define RAMIGA_CODE        103
  323. #define TAB_CODE        66
  324.  
  325. #define CURSOR_UP_CODE        76
  326. #define CURSOR_DOWN_CODE    77
  327. #define CURSOR_RIGHT_CODE    78
  328. #define CURSOR_LEFT_CODE    79
  329.  
  330. #define F01_CODE        80
  331. #define F02_CODE        81
  332. #define F03_CODE        82
  333. #define F04_CODE        83
  334. #define F05_CODE        84
  335. #define F06_CODE        85
  336. #define F07_CODE        86
  337. #define F08_CODE        87
  338. #define F09_CODE        88
  339. #define F10_CODE        89
  340.  
  341.     /* A couple of useful minterms. */
  342.  
  343. #define MINTERM_ZERO        0
  344. #define MINTERM_ONE        ABC | ABNC | ANBC | ANBNC | NABC | NABNC | NANBC | NANBNC
  345. #define MINTERM_COPY        ABC | ABNC | NABC | NABNC
  346. #define MINTERM_NOT_C        ABNC | ANBNC | NABNC | NANBNC
  347. #define MINTERM_B_AND_C        ABC | NABC
  348. #define MINTERM_NOT_B_AND_C    ANBC | NANBC
  349. #define MINTERM_B_OR_C        ABC | ABNC | NABC | NABNC | ANBC | NANBC
  350.  
  351.     /* Printer control bits. */
  352.  
  353. #define PRINT_SERIAL    (1L << 0)
  354. #define PRINT_MODEM    (1L << 1)
  355. #define PRINT_SCREEN    (1L << 2)
  356. #define PRINT_TERMINAL    (1L << 3)
  357. #define PRINT_USERNAME    (1L << 4)
  358. #define PRINT_COMMENT    (1L << 5)
  359. #define PRINT_SIZE    (1L << 6)
  360. #define PRINT_DATE    (1L << 7)
  361. #define PRINT_BITS    (1L << 8)
  362.  
  363.     /* Day of week flags. */
  364.  
  365. #define DAY_MONDAY    (1L << 0)
  366. #define DAY_TUESDAY    (1L << 1)
  367. #define DAY_WEDNESDAY    (1L << 2)
  368. #define DAY_THURSDAY    (1L << 3)
  369. #define DAY_FRIDAY    (1L << 4)
  370. #define DAY_SATURDAY    (1L << 5)
  371. #define DAY_SUNDAY    (1L << 6)
  372.  
  373.     /* These signal masks will make life a bit easier. */
  374.  
  375. #define SIG_WINDOW    (1L << Window -> UserPort -> mp_SigBit)
  376. #define SIG_SERIAL    (ReadPort ? 1L << ReadPort -> mp_SigBit : NULL)
  377. #define SIG_TIMER    (1L << TimePort -> mp_SigBit)
  378. #define SIG_QUEUE    (SpecialQueue -> SigMask)
  379. #define SIG_CHECK    (1L << CheckBit)
  380. #define SIG_WORKBENCH    (1L << WorkbenchPort -> mp_SigBit)
  381. #define SIG_REXX    (1L << TermRexxPort -> mp_SigBit)
  382.  
  383.     /* Task termination and handshake signal. Note: don't try this at
  384.      * home kids, we are all trained professionals here!
  385.      */
  386.  
  387. #define SIG_KILL    SIGBREAKF_CTRL_C
  388. #define SIG_HANDSHAKE    SIGF_SINGLE
  389.  
  390.     /* Double-buffered file server command. */
  391.  
  392. #define    SIG_COMMAND    SIGBREAKF_CTRL_D
  393.  
  394.     /* ARexx break signal. */
  395.  
  396. #define SIG_BREAK    SIGBREAKF_CTRL_D
  397.  
  398.     /* Hotkey reset command. */
  399.  
  400. #define SIG_RESET    SIGBREAKF_CTRL_D
  401.  
  402.     /* Skip dial entry. */
  403.  
  404. #define SIG_SKIP    SIGBREAKF_CTRL_D
  405.  
  406.     /* Status commands. */
  407.  
  408. #define SIG_BELL    SIGBREAKF_CTRL_D
  409. #define SIG_RESETTIME    SIGBREAKF_CTRL_E
  410.  
  411.     /* Buffer special signals. */
  412.  
  413. #define SIG_TOFRONT    SIGBREAKF_CTRL_D
  414. #define SIG_UPDATE    SIGBREAKF_CTRL_E
  415. #define SIG_MOVEUP    SIGBREAKF_CTRL_F
  416.  
  417.     /* Status display task. */
  418.  
  419. #define SIG_CLOSEWINDOW    SIGBREAKF_CTRL_F
  420.  
  421.     /* Upload queue. */
  422.  
  423. #define SIG_SHOW    SIGBREAKF_CTRL_D
  424. #define SIG_HIDE    SIGBREAKF_CTRL_E
  425. #define SIG_GOAWAY    SIGBREAKF_CTRL_F
  426.  
  427.     /* A port signal mask. */
  428.  
  429. #define PORTMASK(P)    (1L << (((struct MsgPort *)(P)) -> mp_SigBit))
  430.  
  431.     /* Replacements for CheckItem() and OnMenu()/OffMenu(). */
  432.  
  433. #define CheckItem(ID,Mode)    SetItem(ID,Mode ? SETITEM_SETCHECK : SETITEM_CLRCHECK)
  434. #define OnItem(ID)        SetItem(ID,SETITEM_ON)
  435. #define OffItem(ID)        SetItem(ID,SETITEM_OFF)
  436.  
  437.     /* A handy signal macro. */
  438.  
  439. #define ClrSignal(Signals)    SetSignal(0,Signals)
  440.  
  441.     /* Another neat macro. */
  442.  
  443. #define NumElements(s)        (sizeof(s) / sizeof((s)[0]))
  444. #define NEW(t)            t = AllocVecPooled(sizeof(* ## t),MEMF_ANY | MEMF_CLEAR)
  445. #define DISPOSE(x)        { FreeVecPooled(x); x = NULL; }
  446.  
  447.     /* Definitions to access the line signal setting functions supported by
  448.      * some IO serial boards (namely the ASDG board).
  449.      */
  450.  
  451. #define SIOCMD_SETCTRLLINES    (CMD_NONSTD + 7)
  452. #define SIOB_RTSB        0
  453. #define SIOB_DTRB        1
  454. #define SIOB_RTSF        (1L << SIOB_RTSB)
  455. #define SIOB_DTRF        (1L << SIOB_DTRB)
  456.  
  457.     /* Turn time of day into `compressed' format. */
  458.  
  459. #define DT_GET_TIME(Hour,Minute) ((Minute) / 10 + (Hour) * 6)
  460.  
  461.     /* Vector offsets for the TimeDate structure. */
  462.  
  463. enum    { DT_FIRST_UNIT,DT_NEXT_UNIT };
  464.  
  465.     /* Multiply lines and columns with the current font size. */
  466.  
  467. #define MUL_X(x)        OffsetXTable[x]
  468. #define MUL_Y(y)        OffsetYTable[y]
  469.  
  470.     /* A handy and short alias. */
  471.  
  472. #define TICK            (CHECKIT | MENUTOGGLE)
  473.  
  474.     /* For now the maximum length of a path/file name. */
  475.  
  476. #define MAX_FILENAME_LENGTH    256
  477.  
  478.     /* The maximum width of a line to be stored in the text buffer. */
  479.  
  480. #define BUFFER_LINE_MAX        255
  481.  
  482.     /* User interface definitions. */
  483.  
  484. #define SZ_AutoWidth    TAG_USER+2    /* Use default width? */
  485. #define SZ_NewColumn    TAG_USER+4    /* Start new column */
  486. #define SZ_Lines    TAG_USER+5    /* Number of lines in object */
  487.  
  488.     /* Box information types. */
  489.  
  490. enum    {    BOX_LEFT,BOX_TOP,BOX_WIDTH,BOX_HEIGHT };
  491.  
  492.     /* Status gadget properties. */
  493.  
  494. #define SGA_FullWidth    (TAG_USER+42)
  495. #define SGA_Mode    (TAG_USER+43)
  496.  
  497.     /* Sizing gadget sizes. */
  498.  
  499. #define SIZE_GADGET_WIDTH_HIGH    18
  500. #define SIZE_GADGET_WIDTH_LOW    13
  501.  
  502.     /* Some windows to be opened on the main screen. */
  503.  
  504. enum    {    WINDOW_PACKET,WINDOW_STATUS,WINDOW_FILE,
  505.         WINDOW_REVIEW,WINDOW_FAST,WINDOW_FONT,
  506.         WINDOW_SCREEN,WINDOW_PERF,WINDOW_MAIN,
  507.  
  508.         WINDOW_COUNT };
  509.  
  510.     /* Window alignment information. */
  511.  
  512. #define WC_ALIGNLEFT    (1<<0)
  513. #define WC_ALIGNRIGHT    (1<<1)
  514. #define WC_ALIGNTOP    (1<<2)
  515. #define WC_ALIGNBOTTOM    (1<<3)
  516. #define WC_EXPANDWIDTH    (1<<4)
  517. #define WC_EXPANDHEIGHT    (1<<5)
  518. #define WC_ALIGNSIDE    (1<<6)
  519. #define WC_ALIGNBELOW    (1<<7)
  520.  
  521.     /* The chat line gadget ID. */
  522.  
  523. #define CHAT_ID        744
  524.  
  525.     /* Screen mode list entry. */
  526.  
  527. struct ModeNode
  528. {
  529.     struct Node    VanillaNode;
  530.     ULONG        DisplayID;
  531. };
  532.  
  533.     /* Trap management. */
  534.  
  535. struct TrapNode
  536. {
  537.     struct Node    Node;
  538.     LONG        Count,
  539.             SequenceLen;
  540.     STRPTR        Sequence,
  541.             Command;
  542. };
  543.  
  544.     /* Trap preferences, not much. */
  545.  
  546. struct TrapSettings
  547. {
  548.     BYTE        Enabled,
  549.             Pad;
  550. };
  551.  
  552.     /* Window alignment data. */
  553.  
  554. struct WindowInfo
  555. {
  556.     UWORD    ID;
  557.     UWORD    WindowFlags;
  558.  
  559.     LONG    Left,
  560.         Top,
  561.         Width,
  562.         Height;
  563. };
  564.  
  565.     /* Special character treatment. */
  566.  
  567. struct SpecialKey
  568. {
  569.     UBYTE    Key;
  570.     BYTE    (*  Routine)(VOID);
  571. };
  572.  
  573.     /* Cursor backup data. */
  574.  
  575. struct CursorData
  576. {
  577.     struct TextFont        *CurrentFont;
  578.     WORD             CursorX,
  579.                  CursorY;
  580.     UBYTE             Charset;
  581.     UBYTE             CharMode[2];
  582.     UBYTE             Attributes;
  583.     UBYTE             FgPen,
  584.                  BgPen;
  585.     UBYTE             Style;
  586. };
  587.  
  588.     /* File transfer information. */
  589.  
  590. struct FileTransferNode
  591. {
  592.     struct MinNode         Node;
  593.     ULONG             Size;
  594.     STRPTR             Name;
  595. };
  596.  
  597. struct FileTransferInfo
  598. {
  599.     struct MinList         FileList;
  600.     ULONG             TotalSize;
  601.     LONG             TotalFiles;
  602.  
  603.     ULONG             DoneSize;
  604.     LONG             DoneFiles;
  605.  
  606.     struct FileTransferNode    *CurrentFile;
  607.     ULONG             CurrentSize;
  608. };
  609.  
  610.     /* Global data link. */
  611.  
  612. struct TermPort
  613. {
  614.     struct MsgPort         ExecNode;
  615.  
  616.     struct Window        *TopWindow;
  617.  
  618.     struct SignalSemaphore     OpenSemaphore;
  619.  
  620.     LONG             ID,OpenCount,HoldIt;
  621.     LONG             Reserved[5];
  622. };
  623.  
  624.     /* Buffer search support. */
  625.  
  626. struct SearchInfo
  627. {
  628.     UBYTE    Distance[256],
  629.         Pattern[256];
  630.     LONG    FoundX,
  631.         FoundY;
  632.     WORD    PatternWidth;
  633.     WORD    Index;
  634.     BOOLEAN    Forward,
  635.         IgnoreCase,
  636.         WholeWords;
  637. };
  638.  
  639. struct SearchContext
  640. {
  641.     struct Window        *SearchWindow;
  642.     struct LayoutHandle    *SearchHandle;
  643.  
  644.     UBYTE             LocalBuffer[256];
  645.     STRPTR             Buffer;
  646.  
  647.     BOOLEAN             Ok;
  648. };
  649.  
  650.     /* Support for optimized scrolling routines. */
  651.  
  652. struct ScrollLineInfo
  653. {
  654.     UWORD             Left,Right,Width,
  655.                  ColourMask;
  656. };
  657.  
  658.     /* A dial list entry. */
  659.  
  660. struct PhoneNode
  661. {
  662.     struct Node         VanillaNode;
  663.  
  664.     UBYTE             LocalName[50];
  665.  
  666.     struct PhoneEntry    *Entry;
  667. };
  668.  
  669.     /* A Fast! macro list entry. */
  670.  
  671. struct MacroNode
  672. {
  673.     struct MacroNode    *mn_Succ;    /* Modeled after the default Node. */
  674.     struct MacroNode    *mn_Pred;
  675.  
  676.     WORD             mn_Pad;    /* Included only for Node compatibility. */
  677.  
  678.     UBYTE            *mn_Macro;    /* = ln_Name, title */
  679.     UBYTE            *mn_Code;    /* The execution code. */
  680. };
  681.  
  682.     /* Speech preferences. */
  683.  
  684. struct SpeechConfig
  685. {
  686.     WORD            Rate,
  687.                 Pitch;
  688.     LONG            Frequency;
  689.     BYTE            Sex,
  690.                 Volume,
  691.                 Enabled,
  692.                 Pad;
  693. };
  694.  
  695.     /* Sound preferences */
  696.  
  697. struct SoundConfig
  698. {
  699.     UBYTE            BellFile[MAX_FILENAME_LENGTH],
  700.  
  701.                 ConnectFile[MAX_FILENAME_LENGTH],
  702.                 DisconnectFile[MAX_FILENAME_LENGTH],
  703.  
  704.                 GoodTransferFile[MAX_FILENAME_LENGTH],
  705.                 BadTransferFile[MAX_FILENAME_LENGTH],
  706.  
  707.                 RingFile[MAX_FILENAME_LENGTH],
  708.                 VoiceFile[MAX_FILENAME_LENGTH];
  709.  
  710.     BYTE            Preload,
  711.                 Pad;
  712.     BYTE            Volume,
  713.                 Pad2;
  714.  
  715.     UBYTE            ErrorNotifyFile[MAX_FILENAME_LENGTH];
  716. };
  717.  
  718.     /* Macro Preferences. */
  719.  
  720. struct MacroKeys
  721. {
  722.     UBYTE            Keys[4][10][256];
  723. };
  724.  
  725.     /* Cursor key preferences. */
  726.  
  727. struct CursorKeys
  728. {
  729.     UBYTE            Keys[4][4][256];
  730. };
  731.  
  732.     /* Translation table entry. */
  733.  
  734. struct TranslationEntry
  735. {
  736.     STRPTR            String;        /* Corresponding code string. */
  737.     UBYTE            Type;        /* Table entry type. */
  738.     UBYTE            Len;        /* String length if any. */
  739.     UBYTE            Extra;        /* Saves space, don't need to allocate memory for this one. */
  740.     UBYTE            Null;        /* Terminating null. */
  741. };
  742.  
  743. struct TranslationHeader
  744. {
  745.     UBYTE            Type;        /* Table entry type. */
  746.     UBYTE            Code;        /* Table offset. */
  747.     UBYTE            Len;        /* Entry length. */
  748.     UBYTE            Pad;
  749. };
  750.  
  751.     /* Buffer translation handle. */
  752.  
  753. struct TranslationHandle
  754. {
  755.     STRPTR            LocalBuffer;
  756.     LONG            LocalLen;
  757.  
  758.     STRPTR            SourceBuffer;
  759.     LONG            SourceLen;
  760.  
  761.     STRPTR            DestinationBuffer;
  762.     LONG            DestinationLen;
  763.  
  764.     struct TranslationEntry    **Table;
  765. };
  766.  
  767.     /* term hotkey configuration. */
  768.  
  769. struct HotkeysOld
  770. {
  771.     UBYTE            termScreenToFront[256];
  772.     UBYTE            BufferScreenToFront[256];
  773.     UBYTE            SkipDialEntry[256];
  774.     BYTE            CommodityPriority;
  775.     BYTE            HotkeysEnabled;
  776.  
  777.     ULONG            Reserved[25];
  778. };
  779.  
  780. struct Hotkeys
  781. {
  782.     UBYTE            termScreenToFront[256];
  783.     UBYTE            BufferScreenToFront[256];
  784.     UBYTE            SkipDialEntry[256];
  785.     BYTE            CommodityPriority;
  786.     BYTE            HotkeysEnabled;
  787.  
  788.     ULONG            Reserved[25];
  789.  
  790.     UBYTE            AbortARexx[256];
  791. };
  792.  
  793.     /* Time/date structure. */
  794.  
  795. struct TimeDate
  796. {
  797.     LONG             Count;        /* Table size. */
  798.     WORD             PayPerUnit[2],    /* Pay for each unit. */
  799.                  SecPerUnit[2];    /* Number of seconds each unit lasts. */
  800.     UBYTE             Time,        /* The time associated with this entry. */
  801.                  Pad;
  802. };
  803.  
  804.     /* Time date header information. */
  805.  
  806. struct TimeDateHeader
  807. {
  808.     UBYTE             Comment[22];    /* Comment for this entry. */
  809.  
  810.     BYTE             Month,        /* Month of year or -1 -> Day = bitmapped days of week. */
  811.                  Day;        /* Day of month or -1 -> standard settings. */
  812. };
  813.  
  814. struct TimeDateNode
  815. {
  816.     struct Node         VanillaNode;    /* Default node entry. */
  817.     UBYTE             Buffer[30];    /* Name buffer. */
  818.  
  819.     struct TimeDate        *Table;        /* Table of time/date entries. */
  820.  
  821.     struct TimeDateHeader     Header;    /* Header information. */
  822. };
  823.  
  824. struct TimeNode
  825. {
  826.     struct Node         VanillaNode;    /* Default node entry. */
  827.     UBYTE             Name[20];    /* Name string. */
  828.     UBYTE             Time;        /* The time for this entry. */
  829. };
  830.  
  831.     /* This node type links phone number patterns
  832.      * and date/time lists.
  833.      */
  834.  
  835. struct PatternNode
  836. {
  837.     struct Node        Node;
  838.     UBYTE            Pattern[256],
  839.                     Comment[40];
  840.     struct List        List;
  841. };
  842.  
  843.     /* Serial settings. */
  844.  
  845. struct SerialSettings
  846. {
  847.     ULONG    BaudRate;        /* Baud rate. */
  848.     ULONG    BreakLength;        /* Length of break signal in microseconds. */
  849.     ULONG    SerialBufferSize;    /* Size of serial read/write buffer. */
  850.  
  851.     UBYTE    SerialDevice[MAX_FILENAME_LENGTH];
  852.                     /* Serial device name. */
  853.     LONG    UnitNumber;        /* Serial device unit number. */
  854.  
  855.     BYTE    BitsPerChar;        /* Bits per character. */
  856.     BYTE    Parity;            /* Parity check mode. */
  857.     BYTE    StopBits;        /* Number of stop bits. */
  858.     BYTE    HandshakingProtocol;    /* Handshaking protocol (RTS/CTS, etc.). */
  859.     BYTE    Duplex;            /* Full- or half-duplex? */
  860.  
  861.     BYTE    xONxOFF;        /* xON/xOFF handshaking enabled? */
  862.     BYTE    HighSpeed;        /* Radboogie? */
  863.     BYTE    Shared;            /* Shared device access? */
  864.     BYTE    StripBit8;        /* Strip high-order bit? */
  865.     BYTE    CheckCarrier;        /* Track the carrier signal? */
  866.     BYTE    PassThrough;        /* Pass xON/xOFF characters through to modem? */
  867.     BYTE    UseOwnDevUnit;        /* Enable OwnDevUnit.library? */
  868.  
  869.     ULONG    Quantum;        /* Buffer read quantum. */
  870.  
  871.     BYTE    IgnoreCarrier;        /* Ignore carrier signal. */
  872.  
  873.     BYTE    UseNet;            /* Use DNet-ID. */
  874.     UWORD    NetID;            /* The DNet-ID to use. */
  875.  
  876.     BYTE    SatisfyODURequests;    /* How to satisfy ODU requests. */
  877.     BYTE    DirectConnection;    /* Directly connected to host? */
  878.  
  879.     UWORD    LastVersionSaved,    /* The last version the config file was saved with. */
  880.         LastRevisionSaved;
  881. };
  882.  
  883.     /* Modem settings. */
  884.  
  885. struct ModemSettings
  886. {
  887.     UBYTE    ModemInit[80];        /* Modem init string. */
  888.     UBYTE     ModemExit[80];        /* Modem exit string. */
  889.     UBYTE     ModemHangup[80];    /* Modem hangup string. */
  890.     UBYTE    DialPrefix[80];        /* Dial command prefix. */
  891.     UBYTE    DialSuffix[80];        /* Dial command suffix. */
  892.  
  893.     UBYTE    NoCarrier[16];        /* `No carrier' string. */
  894.     UBYTE    NoDialTone[16];        /* `No dialtone' string. */
  895.     UBYTE    Connect[16];        /* `Connect' string. */
  896.     UBYTE    Voice[16];        /* `Voice' string. */
  897.     UBYTE    Ring[16];        /* `Ring' string. */
  898.     UBYTE    Busy[16];        /* `Busy' string. */
  899.  
  900.     LONG    RedialDelay;        /* Length of redial delay. */
  901.     LONG    DialRetries;        /* Number of dial retries. */
  902.     LONG    DialTimeout;        /* Length of dial timeout. */
  903.     BYTE    ConnectAutoBaud;    /* Use baud rate returned by modem? */
  904.     BYTE    DropDTR;        /* Drop the DTR signal on hangup? */
  905.     BYTE    RedialAfterHangup;    /* Redial list after hangup? */
  906.     BYTE    VerboseDialing;        /* Output modem responses while dialing? */
  907.  
  908.     UBYTE    Ok[16];            /* `Ok' string. */
  909.     UBYTE    Error[16];        /* `Error' string. */
  910.  
  911.     BYTE    NoCarrierIsBusy;    /* Treat `NO CARRIER' as `BUSY' signal? */
  912.     BYTE    AbortHangsUp;        /* Dialer `Abort' sends hangup string? */
  913.  
  914.     WORD    ConnectLimit;                /* Connection limit. */
  915.     UBYTE    ConnectLimitMacro[MAX_FILENAME_LENGTH];    /* Macro to be executed when limit is reached. */
  916.  
  917.     LONG    TimeToConnect;        /* Number of seconds to pass between modem picking up
  918.                      * the line and issuing the `CONNECT' message.
  919.                      */
  920.  
  921.     BYTE    DialMode;        /* Use tone or pulse dialing? */
  922.     BYTE    Pad;
  923.  
  924.     LONG    InterDialDelay;        /* Seconds to wait between two successive dial attempts. */
  925.  
  926.     LONG    CharSendDelay;        /* Microseconds to wait between chars to send. */
  927. };
  928.  
  929.     /* Command settings. */
  930.  
  931. struct CommandSettings
  932. {
  933.     UBYTE    StartupMacro[256];    /* Startup macro. */
  934.     UBYTE    LogoffMacro[256];    /* Macro executed after carrier has dropped or hung up. */
  935.     UBYTE    UploadMacro[256];    /* Macro to execute after a successful upload. */
  936.     UBYTE    DownloadMacro[256];    /* Macro to execute after a successful download. */
  937.  
  938.     UBYTE    LoginMacro[256];    /* Login macro, complements the logoff macro. */
  939. };
  940.  
  941.     /* Screen settings. */
  942.  
  943. struct ScreenSettings
  944. {
  945.     ULONG    DisplayMode;            /* Screen display mode. */
  946.     WORD    ColourMode;            /* The terminal colour mode. */
  947.     UWORD    Colours[16];            /* Colour palette. */
  948.     UBYTE    FontName[MAX_FILENAME_LENGTH];    /* Default user interface font. */
  949.     WORD    FontHeight;            /* Default user interface font height. */
  950.  
  951.     BYTE    MakeScreenPublic;        /* Are we to make our screen public? */
  952.     BYTE    ShanghaiWindows;        /* Are we to `shanghai' windows? */
  953.  
  954.     BYTE    Blinking;            /* Screen blinking enabled? */
  955.     BYTE    FasterLayout;            /* Faster screen layout? */
  956.     BYTE    TitleBar;            /* Is the screen title bar enabled? */
  957.     BYTE    StatusLine;            /* Which mode is the status line in? */
  958.  
  959.     BYTE    UseWorkbench;            /* Use the Workbench screen for the terminal window? */
  960.  
  961.     UBYTE    PubScreenName[MAXPUBSCREENNAME + 1];    /* Name of public screen to open window upon. */
  962.  
  963.     BYTE    TimeMode;            /* Online time/fee display. */
  964.     BYTE    Depth;                /* Screen depth if any, 0 = don't bother. */
  965.  
  966.     BYTE    UsePens;            /* Use special screen pens? */
  967.     BYTE    PenColourMode;            /* For which colour mode was the pen array built? */
  968.  
  969.     UWORD    PenArray[16];            /* Pen index array. */
  970.  
  971.     ULONG    DisplayWidth,            /* Screen width. */
  972.         DisplayHeight;            /* Screen height. */
  973.     UWORD    OverscanType;            /* Screen overscan type. */
  974.  
  975.     BYTE    ShareScreen;            /* Don't open a backdrop window, share pens. */
  976.     BYTE    SplitStatus;            /* Split the status line from the main window. */
  977.  
  978.     BYTE    Pad;
  979.     BYTE    UseColours96;            /* Use the 96 bit colours? */
  980.     ULONG    Colours96[16 * 3];        /* The 96 bit colour table. */
  981. };
  982.  
  983.     /* Terminal settings. */
  984.  
  985. struct TerminalSettings
  986. {
  987.     BYTE    BellMode;                /* The bell mode. */
  988.     BYTE    AlertMode;                /* The user alert mode. */
  989.     BYTE    EmulationMode;                /* The terminal emulation mode. */
  990.     BYTE    FontMode;                /* The font mode. */
  991.  
  992.     BYTE    SendCR;                    /* Standard translations. */
  993.     BYTE    SendLF;
  994.     BYTE    ReceiveCR;
  995.     BYTE    ReceiveLF;
  996.  
  997.     UWORD    NumColumns,                /* Size of the terminal window. */
  998.         NumLines;
  999.  
  1000.     UBYTE    KeyMapFileName[MAX_FILENAME_LENGTH];    /* Name of custom keymap file. */
  1001.     UBYTE    EmulationFileName[MAX_FILENAME_LENGTH];    /* External emulation file name. */
  1002.     UBYTE    BeepFileName[MAX_FILENAME_LENGTH];    /* Name of the custom beep sound file. */
  1003.  
  1004.     UBYTE    TextFontName[MAX_FILENAME_LENGTH];    /* Terminal text font name. */
  1005.     WORD    TextFontHeight;                /* Terminal text font height. */
  1006.  
  1007.     BYTE    UseTerminalTask;            /* Enable the terminal emulation process. */
  1008.     BYTE    Pad;
  1009.  
  1010.     UBYTE    IBMFontName[MAX_FILENAME_LENGTH];    /* Terminal text font name. */
  1011.     WORD    IBMFontHeight;                /* Terminal text font height. */
  1012. };
  1013.  
  1014.     /* Path settings. */
  1015.  
  1016. struct PathSettings
  1017. {
  1018.     UBYTE    ASCIIUploadPath[MAX_FILENAME_LENGTH];        /* Default ASCII upload file path. */
  1019.     UBYTE    ASCIIDownloadPath[MAX_FILENAME_LENGTH];        /* Default ASCII download file path. */
  1020.  
  1021.     UBYTE    TextUploadPath[MAX_FILENAME_LENGTH];        /* Default text upload file path. */
  1022.     UBYTE    TextDownloadPath[MAX_FILENAME_LENGTH];        /* Default text download file path. */
  1023.  
  1024.     UBYTE    BinaryUploadPath[MAX_FILENAME_LENGTH];        /* Default binary data upload file path. */
  1025.     UBYTE    BinaryDownloadPath[MAX_FILENAME_LENGTH];    /* Default binary data download file path. */
  1026.  
  1027.     UBYTE    DefaultStorage[MAX_FILENAME_LENGTH];        /* Default configuration storage path. */
  1028.  
  1029.     UBYTE    Editor[MAX_FILENAME_LENGTH];            /* Text file editor to use. */
  1030.  
  1031.     UBYTE    HelpFile[MAX_FILENAME_LENGTH];            /* Help text file. */
  1032. };
  1033.  
  1034.     /* Miscellaneous settings. */
  1035.  
  1036. struct MiscSettings
  1037. {
  1038.     BYTE    Priority;        /* Program priority. */
  1039.     BYTE    BackupConfig;        /* Save the configuration between calls? */
  1040.  
  1041.     BYTE    OpenFastMacroPanel;    /* Open the fast! macro panel? */
  1042.     BYTE    ReleaseDevice;        /* Release serial device when iconified? */
  1043.  
  1044.     BYTE    TransferServer;        /* Enable data transfer server? */
  1045.     BYTE    EmulationServer;    /* Enable terminal emulation server? */
  1046.  
  1047.     BYTE    OverridePath;        /* Override the protocol transfer path? */
  1048.     BYTE    AutoUpload;        /* Enable the auto-upload panel? */
  1049.     BYTE    SetArchivedBit;        /* Set the archived bit for files sent? */
  1050.     BYTE    IdentifyFiles;        /* Try to identify files after download? */
  1051.  
  1052.     BYTE    TransferIcons;        /* Transfer files along with their icons? */
  1053.     BYTE    CreateIcons;        /* Create icons for files saved? */
  1054.  
  1055.     BYTE    SimpleIO;        /* Use simple file I/O? */
  1056.     BYTE    PerfMeter;        /* Transfer performance meter enabled? */
  1057.  
  1058.     LONG    IOBufferSize;        /* Size of the asynchronous I/O buffer. */
  1059.  
  1060.     BYTE    HideUploadIcon;        /* Hide the upload queue icon? */
  1061.     BYTE    ProtectiveMode;        /* Give hints and ask for confirmation? */
  1062.  
  1063.     BYTE    AlertMode;        /* The user alert mode. */
  1064.  
  1065.     BYTE    RequesterMode;        /* Centre, ignore, use preference? */
  1066.  
  1067.     UWORD    RequesterWidth,        /* Width of asl requesters. */
  1068.         RequesterHeight;    /* Height of asl requesters. */
  1069.     UWORD    RequesterLeft,        /* Left edge of asl requesters. */
  1070.         RequesterTop;        /* Top edge of asl requesters. */
  1071. };
  1072.  
  1073.     /* Clipboard settings. */
  1074.  
  1075. struct ClipSettings
  1076. {
  1077.     WORD    ClipboardUnit;        /* Clipboard unit to use. */
  1078.  
  1079.     WORD    LineDelay,        /* Insert line delay. */
  1080.         CharDelay;        /* Insert character delay. */
  1081.  
  1082.     UBYTE    InsertPrefix[80];    /* Line insertion prefix. */
  1083.     UBYTE    InsertSuffix[80];    /* Line insertion suffix. */
  1084.  
  1085.     UBYTE    LinePrompt[256];    /* Line wait prompt. */
  1086.     WORD    SendTimeout;        /* Line send timeout. */
  1087.     UBYTE    PacingMode;        /* Text pacing mode. */
  1088.     BYTE    ConvertLF;        /* Convert <LF> characters to <CR> */
  1089. };
  1090.  
  1091.     /* Capture and logfile settings. */
  1092.  
  1093. struct CaptureSettings
  1094. {
  1095.     BYTE    LogActions;                /* Create logfile? */
  1096.     BYTE    LogCall;                /* Create callinfo-compatible logfile? */
  1097.     UBYTE    LogFileName[MAX_FILENAME_LENGTH];    /* Default logfile name. */
  1098.  
  1099.     LONG    MaxBufferSize;                /* Maximum text buffer size. */
  1100.     BYTE    BufferEnabled;                /* Is the text buffer enabled? */
  1101.  
  1102.     BYTE    ConnectAutoCapture;            /* Open capture file on logon? */
  1103.     BYTE    CaptureFilterMode;            /* The capture filter mode. */
  1104.     UBYTE    CapturePath[MAX_FILENAME_LENGTH];    /* The default path for capture files. */
  1105.  
  1106.     UBYTE    CallLogFileName[MAX_FILENAME_LENGTH];    /* Name of the call log file. */
  1107.     UBYTE    BufferPath[MAX_FILENAME_LENGTH];    /* Text buffer save path. */
  1108.  
  1109.     BYTE    AutoCaptureDate;            /* Where to include the creation date? */
  1110.     UBYTE    SearchHistory;
  1111.  
  1112.     BYTE    OpenBufferWindow;            /* Where to open the buffer window. */
  1113.     BYTE    OpenBufferScreen;            /* Where to open the buffer screen. */
  1114.  
  1115.     BYTE    BufferScreenPosition;            /* Where to place the buffer screen (horizontal) */
  1116.     UBYTE    BufferWidth;                /* How long each line in the buffer should be. */
  1117.  
  1118.     BYTE    RememberBufferWindow;            /* Remember buffer window context? */
  1119.     BYTE    RememberBufferScreen;            /* Remember buffer screen context? */
  1120.  
  1121.     ULONG    BufferScreenMode;            /* Screen display mode for buffer screen. */
  1122.  
  1123.     BYTE    ConvertChars;                /* Convert IBM characters? */
  1124.     BYTE    Pad;
  1125. };
  1126.  
  1127.     /* File settings. */
  1128.  
  1129. struct FileSettings
  1130. {
  1131.     UBYTE    ProtocolFileName[MAX_FILENAME_LENGTH];        /* Transfer protocol file name. */
  1132.     UBYTE    TranslationFileName[MAX_FILENAME_LENGTH];    /* Character translation file name. */
  1133.     UBYTE    MacroFileName[MAX_FILENAME_LENGTH];        /* Keyboard macro file name. */
  1134.     UBYTE    CursorFileName[MAX_FILENAME_LENGTH];        /* Cursor key file name. */
  1135.     UBYTE    FastMacroFileName[MAX_FILENAME_LENGTH];        /* Fast macro file name. */
  1136. };
  1137.  
  1138.     /* Emulation settings. */
  1139.  
  1140. struct EmulationSettings
  1141. {
  1142.     BYTE    CursorMode;        /* Are the cursor keys switched to application mode? */
  1143.     BYTE    NumericMode;        /* Is the numeric keypad switched to application mode? */
  1144.  
  1145.     BYTE    CursorWrap;        /* Is cursor position wrapping enabled? */
  1146.     BYTE    LineWrap;        /* Is character line wrapping enabled? */
  1147.  
  1148.     BYTE    InsertMode;        /* Is the character insertion mode enabled? */
  1149.     BYTE    NewLineMode;        /* Is the newline mode enabled? */
  1150.  
  1151.     BYTE    FontScale;        /* Which font scale is enabled? */
  1152.     BYTE    ScrollMode;        /* Is smooth scrolling enabled? */
  1153.     BYTE    DestructiveBackspace;    /* Backspace erases characters? */
  1154.     BYTE    SwapBSDelete;        /* DEL and BS keys are swapped? */
  1155.     BYTE    PrinterEnabled;        /* Printer commands enabled? */
  1156.     BYTE    CLSResetsCursor;    /* Clear screen command resets cursor position? */
  1157.  
  1158.     UBYTE    AnswerBack[80];        /* Answer-back message. */
  1159.  
  1160.     BYTE    KeysLocked;        /* Numeric keypad mode locked? */
  1161.     UBYTE    MaxScroll;        /* Maximum number of lines to prescroll. */
  1162.     UBYTE    MaxJump;        /* Maximum number of lines to scroll in one jump. */
  1163.     BYTE    CursorLocked;        /* Cursor keys locked? */
  1164.     BYTE    FontLocked;        /* Font size locked? */
  1165.     BYTE    LockWrapping;        /* Line wrapping locked? */
  1166.     BYTE    LockStyle;        /* Text style locked? */
  1167.     BYTE    LockColour;        /* Text colour locked? */
  1168.  
  1169.     BYTE    UseStandardPens;    /* Use the standard pens/attributes? */
  1170.     BYTE    Pad;
  1171.  
  1172.     UBYTE    Attributes[4];        /* Attribute mappings. */
  1173.     UWORD    Pens[16];        /* Rendering pens. */
  1174. };
  1175.  
  1176. struct TransferSignature
  1177. {
  1178.     UBYTE    Signature[40];
  1179.     WORD    Length;
  1180. };
  1181.  
  1182.     /* File transfer library settings. */
  1183.  
  1184. struct TransferSettings
  1185. {
  1186.     UBYTE    DefaultLibrary[MAX_FILENAME_LENGTH],
  1187.         ASCIIUploadLibrary[MAX_FILENAME_LENGTH],
  1188.         ASCIIDownloadLibrary[MAX_FILENAME_LENGTH],
  1189.         TextUploadLibrary[MAX_FILENAME_LENGTH],
  1190.         TextDownloadLibrary[MAX_FILENAME_LENGTH],
  1191.         BinaryUploadLibrary[MAX_FILENAME_LENGTH],
  1192.         BinaryDownloadLibrary[MAX_FILENAME_LENGTH];
  1193.     BYTE    InternalASCIIUpload,
  1194.         InternalASCIIDownload,
  1195.         QuietTransfer,
  1196.         MangleFileNames;
  1197.  
  1198.     WORD    LineDelay,        /* Insert line delay. */
  1199.         CharDelay;        /* Insert character delay. */
  1200.  
  1201.     UBYTE    LinePrompt[256];    /* Line wait prompt. */
  1202.     WORD    SendTimeout;        /* Line send timeout. */
  1203.     UBYTE    PacingMode;        /* Text pacing mode. */
  1204.     BYTE    StripBit8;        /* Strip high order bit. */
  1205.     BYTE    IgnoreDataPastArnold;    /* Ignore data past terminator. */
  1206.     UBYTE    TerminatorChar;        /* Terminator character. */
  1207.     BYTE    SendCR,
  1208.         SendLF,
  1209.         ReceiveCR,
  1210.         ReceiveLF;
  1211.  
  1212.     UWORD    ErrorNotification;    /* Notify user after <n> errors have occured. */
  1213.     BYTE    TransferNotification;    /* Notify the user when a transfer has started/finished? */
  1214.     BYTE    DefaultType,
  1215.         ASCIIDownloadType,
  1216.         ASCIIUploadType,
  1217.         TextDownloadType,
  1218.         TextUploadType,
  1219.         BinaryUploadType,
  1220.         BinaryDownloadType;
  1221.  
  1222.     struct TransferSignature Signatures[TRANSFERSIG_BINARYDOWNLOAD + 1];
  1223.  
  1224.     BYTE    OverridePath;        /* Override the protocol transfer path? */
  1225.     BYTE    SetArchivedBit;        /* Set the archived bit for files sent? */
  1226.     BYTE    IdentifyFiles;        /* Try to identify files after download? */
  1227.     BYTE    TransferIcons;        /* Transfer files along with their icons? */
  1228.     BYTE    PerfMeter;        /* Transfer performance meter enabled? */
  1229.     BYTE    HideUploadIcon;        /* Hide the upload queue icon? */
  1230. };
  1231.  
  1232.     /* The new configuration settings. */
  1233.  
  1234. struct Configuration
  1235. {
  1236.     struct SerialSettings        *SerialConfig;
  1237.     struct ModemSettings        *ModemConfig;
  1238.     struct ScreenSettings        *ScreenConfig;
  1239.     struct TerminalSettings        *TerminalConfig;
  1240.     struct EmulationSettings    *EmulationConfig;
  1241.     struct ClipSettings        *ClipConfig;
  1242.     struct CaptureSettings        *CaptureConfig;
  1243.     struct CommandSettings        *CommandConfig;
  1244.     struct MiscSettings        *MiscConfig;
  1245.     struct PathSettings        *PathConfig;
  1246.     struct FileSettings        *FileConfig;
  1247.     struct TransferSettings        *TransferConfig;
  1248. };
  1249.  
  1250.     /* Phonebook entry header. */
  1251.  
  1252. struct PhoneHeader
  1253. {
  1254.     UBYTE    Name[40],        /* BBS name. */
  1255.         Number[100],        /* Phone number. */
  1256.         Comment[100];        /* Comment. */
  1257.  
  1258.     UBYTE    UserName[100],        /* User name for this BSS. */
  1259.         Password[100];        /* Password for user name. */
  1260.  
  1261.     BYTE    QuickMenu;        /* This entry appears in the quick dial menu? */
  1262.     BYTE    Pad;
  1263. };
  1264.  
  1265.     /* A phonebook entry. */
  1266.  
  1267. struct PhoneEntry
  1268. {
  1269.     struct PhoneNode    *Node;
  1270.  
  1271.     struct MinList         TimeDateList;
  1272.  
  1273.     LONG             Count;
  1274.  
  1275.     struct PhoneHeader    *Header;
  1276.     struct Configuration    *Config;
  1277. };
  1278.  
  1279.     /* A text box for several lines of text. */
  1280.  
  1281. struct TextBox
  1282. {
  1283.     struct TextBox        *NextBox;        /* Next box in chain. */
  1284.  
  1285.     LONG             Left,Top,        /* Position and size. */
  1286.                  Width,Height;
  1287.  
  1288.     LONG             LineWidth,        /* Line width in pixels. */
  1289.                  LineHeight;        /* Line height in pixels. */
  1290.  
  1291.     LONG             NumChars,        /* Number of chars per line. */
  1292.                  NumLines;        /* Number of lines. */
  1293.  
  1294.     STRPTR            *Title,            /* Line titles. */
  1295.                 *Text;            /* Line texts. */
  1296.  
  1297.     LONG             TitleFgPen,
  1298.                  TitleBgPen,
  1299.                  TextPen;
  1300. };
  1301.  
  1302.     /* Block marker structure. */
  1303.  
  1304. struct BlockMarker
  1305. {
  1306.         /* The object to manipulate. */
  1307.  
  1308.     APTR            Object;
  1309.  
  1310.         /* Selection and unselection routines. */
  1311.  
  1312.     VOID         (* Select)(struct BlockMarker *Marker,LONG Left,LONG Top,LONG Width,LONG Height);
  1313.     VOID         (* Unselect)(struct BlockMarker *Marker,LONG Left,LONG Top,LONG Width,LONG Height);
  1314.  
  1315.         /* Origin anchor point. */
  1316.  
  1317.     LONG            OriginX,
  1318.                 OriginY;
  1319.  
  1320.         /* First and last selected line. */
  1321.  
  1322.     LONG            FirstLine,
  1323.                 LastLine;
  1324.  
  1325.         /* First and last selected column. */
  1326.  
  1327.     LONG            FirstColumn,
  1328.                 LastColumn;
  1329.  
  1330.         /* Top of display window, lines in the buffer and size of
  1331.          * the display window.
  1332.          */
  1333.  
  1334.     LONG            Top,
  1335.                 Lines,
  1336.                 Width,
  1337.                 Height;
  1338.  
  1339.         /* Canvas left and top edge. */
  1340.  
  1341.     LONG            LeftEdge,
  1342.                 TopEdge;
  1343.  
  1344.         /* Last mouse position. */
  1345.  
  1346.     LONG            LastX,
  1347.                 LastY;
  1348.  
  1349.         /* Single character dimensions. */
  1350.  
  1351.     LONG            TextFontWidth,
  1352.                 TextFontHeight;
  1353.  
  1354.         /* Plane write mask. */
  1355.  
  1356.     UBYTE            WriteMask;
  1357. };
  1358.  
  1359.     /* Global data flow <-> term interface. */
  1360.  
  1361. struct FlowInfo
  1362. {
  1363.     BYTE            Changed;
  1364.  
  1365.     BYTE            NoCarrier;
  1366.  
  1367.     BYTE            Connect,
  1368.                 Voice,
  1369.                 Ring,
  1370.                 Busy,
  1371.                 NoDialTone,
  1372.                 Ok,
  1373.                 Error;
  1374.  
  1375.     BYTE            Signature;
  1376. };
  1377.  
  1378.     /* A scan sequence, somewhat similar to the FlowInfo structure. */
  1379.  
  1380. struct WaitNode
  1381. {
  1382.     struct Node    Node;
  1383.     LONG        Count;        /* Number of characters matched. */
  1384.     STRPTR        Response;    /* Immediate response. */
  1385.     LONG        ResponseLen;    /* Length of immediate response string. */
  1386. };
  1387.  
  1388. struct DialNode
  1389. {
  1390.     struct Node         Node;        // List link
  1391.     struct PhoneEntry    *Entry;        // Points to the configuration data
  1392. };
  1393.  
  1394.     /* A list as employed by the ARexx interface. */
  1395.  
  1396. struct GenericList
  1397. {
  1398.     struct MinList         ListHeader;
  1399.     struct Node        *ListNode;
  1400.     LONG             ListCount;
  1401.     struct SignalSemaphore     ListSemaphore;
  1402. };
  1403.  
  1404.     /* Number of buffers to be used for buffered I/O. */
  1405.  
  1406. #define BUFFER_NUMBER        2
  1407.  
  1408.     /* Auxiliary structure for buffered file I/O. */
  1409.  
  1410. struct Buffer
  1411. {
  1412.     struct Message             Message;            /* Vanilla message header. */
  1413.  
  1414.     BYTE                 SimpleIO;            /* Real simple I/O? */
  1415.     BYTE                 Pad;
  1416.  
  1417.     BYTE                 Read;                /* Last access has read data. */
  1418.     BYTE                 Written;            /* Last access has written data. */
  1419.  
  1420.     LONG                 Action;            /* Action to perform. */
  1421.     LONG                 ActionData[2];            /* Seek and the like. */
  1422.     LONG                 Result;            /* Return value. */
  1423.  
  1424.     BPTR                 FileHandle;            /* Dos filehandle. */
  1425.  
  1426.     UBYTE                *Data;                /* Data buffer. */
  1427.     LONG                 BufLength;            /* Length of data buffer. */
  1428.  
  1429.     LONG                 BufPosition;            /* Read/write pointer into buffer. */
  1430.  
  1431.     LONG                 ReadBufFull;            /* How many bytes are still to be read from the buffer? */
  1432.     LONG                 WriteBufFull;            /* How many bytes are still to be written to the buffer?*/
  1433.  
  1434.     LONG                 RealPosition;            /* Real position in file. */
  1435.     LONG                 Cached;            /* How many bytes in pre-load cache. */
  1436.  
  1437.     UBYTE                *DataBuffer[BUFFER_NUMBER];    /* The data buffers. */
  1438.     LONG                 DataLength[BUFFER_NUMBER];    /* The lengths of the data buffers. */
  1439.     WORD                 DataCount;            /* Which buffer to use. */
  1440.     BYTE                 WriteAccess;            /* TRUE if a write file handle. */
  1441.     BYTE                 LastActionFailed;        /* TRUE if last action failed -> abort actions. */
  1442.  
  1443.     struct Process            *Child;
  1444.     struct Process            *Caller;            /* Synchronization. */
  1445.  
  1446.     struct MsgPort            *InfoPort;            /* The filing system the destination file handle is bound to. */
  1447.     struct InfoData __aligned     InfoData;
  1448.  
  1449.     BYTE                 Fresh;                /* TRUE if no read/write access has taken place yet. */
  1450.     BYTE                 Used;                /* Did any access take place at all? */
  1451.  
  1452.     struct DateStamp         OpenDate;            /* Date and time when file was opened. */
  1453. };
  1454.  
  1455.     /* xpr serial bits. */
  1456.  
  1457. #define ST_PARTYON    (1L << 0)
  1458. #define ST_PARTYODD    (1L << 1)
  1459. #define ST_7WIRE    (1L << 2)
  1460. #define ST_QBREAK    (1L << 3)
  1461. #define ST_RADBOOGIE    (1L << 4)
  1462. #define ST_SHARED    (1L << 5)
  1463. #define ST_EOFMODE    (1L << 6)
  1464. #define ST_XDISABLED    (1L << 7)
  1465. #define ST_PARTYMARKON    (1L << 8)
  1466. #define ST_PARTYMARK    (1L << 9)
  1467. #define ST_2BITS    (1L << 10)
  1468. #define ST_READ7    (1L << 11)
  1469. #define ST_WRITE7    (1L << 12)
  1470.  
  1471.     /* Miscellaneous definitions. */
  1472.  
  1473. #define MILLION        1000000
  1474.  
  1475.     /* Raster text line attributes. */
  1476.  
  1477. #define    ATTR_UNDERLINE    1
  1478. #define    ATTR_HIGHLIGHT    2
  1479. #define ATTR_BLINK    4
  1480. #define    ATTR_INVERSE    8
  1481.  
  1482. enum    {    TEXTATTR_UNDERLINE,TEXTATTR_HIGHLIGHT,
  1483.         TEXTATTR_BLINK,TEXTATTR_INVERSE,
  1484.         TEXTATTR_NONE
  1485.     };
  1486.  
  1487.     /* Audio channels. */
  1488.  
  1489. #define LEFT0F  1
  1490. #define RIGHT0F  2
  1491. #define RIGHT1F  4
  1492. #define LEFT1F  8
  1493.  
  1494.     /* Program revision and the approriate info structure. */
  1495.  
  1496. struct TermInfo
  1497. {
  1498.     UWORD    Version;
  1499.     UWORD    Revision;
  1500. };
  1501.  
  1502. /**********************************************************************/
  1503.  
  1504.  
  1505.     // This defines the destructor data type
  1506.  
  1507. typedef VOID (* __stdargs DESTRUCTOR)(struct MsgItem *);
  1508.  
  1509.     // A message queue handle
  1510.  
  1511. struct MsgQueue
  1512. {
  1513.     struct SignalSemaphore     Access;    // Access semaphore
  1514.     struct MinList         MsgList;    // This is where the queue items go
  1515.  
  1516.     LONG             QueueSize,    // The length of the queue
  1517.                  MaxSize;    // The maximum size of the queue, may be 0
  1518.  
  1519.     struct MinList         WaitList;    // The list of tasks to wait for a wakeup signal
  1520.  
  1521.     struct Task        *SigTask;    // The owner of this handle
  1522.     ULONG             SigMask;    // The signal mask to wake up the owner
  1523.     WORD             SigBit;    // The bit allocated for the mask, may be -1
  1524.  
  1525.     BOOL             Discard;    // Discard or queue new items?
  1526. };
  1527.  
  1528.     // A message item as used by the queue manager
  1529.  
  1530. struct MsgItem
  1531. {
  1532.     struct MinNode         Link;        // List node link
  1533.     DESTRUCTOR         Destructor;    // Destructor routine if any
  1534. };
  1535.  
  1536.     // Your simple message item destructor setup
  1537.  
  1538. #define InitMsgItem(Item,Dest)    (((struct MsgItem *)Item) -> Destructor = (Dest))
  1539.  
  1540.  
  1541. /**********************************************************************/
  1542.  
  1543.  
  1544. enum    {    DATAMSGTYPE_WRITE,DATAMSGTYPE_WRITECLIP,
  1545.         DATAMSGTYPE_UPDATEREVIEW,DATAMSGTYPE_MOVEREVIEW,
  1546.         DATAMSGTYPE_SERIALCOMMAND,DATAMSGTYPE_UPLOAD,
  1547.         DATAMSGTYPE_COMMANDDONE,DATAMSGTYPE_MENU,
  1548.         DATAMSGTYPE_RENDEZVOUS,DATAMSGTYPE_SERIALCOMMANDNOECHO
  1549.     };
  1550.  
  1551.     // An extension of the MsgItem data type
  1552.  
  1553. struct DataMsg
  1554. {
  1555.     struct MsgItem    Item;    // The message item link
  1556.  
  1557.     LONG        Type;    // Message type
  1558.     UBYTE *        Data;    // Pointer to data area
  1559.     LONG        Size;    // Size of data area
  1560.  
  1561.     struct Task *    Client;    // Client task to signal
  1562.     ULONG        Mask;    // Client signal mask
  1563. };
  1564.  
  1565.     // An extension of the DataMsg data type
  1566.  
  1567. struct DataReplyMsg
  1568. {
  1569.     struct DataMsg    Data;        // DataMsg link
  1570.  
  1571.     struct Task *    Creator;    // Creator to notify
  1572.     ULONG        CreatorMask;    // Creator notification signal
  1573. };
  1574.  
  1575.  
  1576. /**********************************************************************/
  1577.  
  1578.  
  1579.     // Serial device attributes
  1580.  
  1581. #define SERA_Baud        TAG_USER+1    // Baud rate
  1582. #define SERA_BreakTime        TAG_USER+2    // Break time
  1583. #define SERA_BitsPerChar    TAG_USER+3    // Bits per character
  1584. #define SERA_StopBits        TAG_USER+4    // Number of stop bits
  1585. #define SERA_BufferSize        TAG_USER+5    // Read/Write buffer size
  1586. #define SERA_Parity        TAG_USER+6    // Parity
  1587. #define SERA_Handshaking    TAG_USER+7    // Handshaking mode
  1588. #define SERA_HighSpeed        TAG_USER+8    // Highspeed mode
  1589. #define SERA_Shared        TAG_USER+9    // Shared access
  1590.  
  1591.  
  1592. /**********************************************************************/
  1593.  
  1594.  
  1595.     /* One of the emulation callback routines. */
  1596.  
  1597. typedef VOID (*  EPTR)(STRPTR Buffer);
  1598.  
  1599.     /* This structure describes an ANSI control sequence. */
  1600.  
  1601. struct ControlCode
  1602. {
  1603.     UBYTE    FirstChar;
  1604.     STRPTR    Match,
  1605.         Terminator;
  1606.     UBYTE    LastChar;
  1607.  
  1608.     BYTE    ExactSize;
  1609.     EPTR    Func;
  1610. };
  1611.  
  1612.  
  1613. /**********************************************************************/
  1614.  
  1615.  
  1616.     /* A 96 bit colour entry. */
  1617.  
  1618. typedef struct ColourEntry
  1619. {
  1620.     ULONG            Red,
  1621.                 Green,
  1622.                 Blue;
  1623. } ColourEntry;
  1624.  
  1625.     /* A table of colour entries, ready for LoadRGB32(). */
  1626.  
  1627. typedef struct ColourTable
  1628. {
  1629.     WORD        NumColours,
  1630.             FirstColour;
  1631.  
  1632.     ColourEntry    Entry[0];
  1633.  
  1634.     WORD        Terminator;
  1635. } ColourTable;
  1636.  
  1637.     /* Spread a byte across a long word. */
  1638.  
  1639. #define SPREAD(v)    ((ULONG)(v) << 24 | (ULONG)(v) << 16 | (ULONG)(v) << 8 | (v))
  1640.  
  1641.     /* Do the same with a word. */
  1642.  
  1643. #define SPREADW(v)    ((ULONG)(v) << 16 | (v))
  1644.  
  1645.  
  1646. /**********************************************************************/
  1647.  
  1648.  
  1649.     /* AmigaUW terminal window resize support. */
  1650.  
  1651. #define UWCMD_TTYRESIZE (CMD_NONSTD)+20
  1652.  
  1653.  
  1654. /**********************************************************************/
  1655.  
  1656.  
  1657.     /* And now for something completely different... */
  1658.  
  1659. #include "termProtos.h"
  1660. #include "termData.h"
  1661. #include "termErrors.h"
  1662.